<template>
  <div class="yellow">
    <hello-world />
  </div>
</template>

<script>
import request from "@/utils/request";
import { MessageBox } from "element-ui";

import HelloWorld from "@/components/HelloWorld";
import { loading } from "@/decorator";

function mockData(pageSize) {
  console.log("pageSize: ", pageSize);
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      if (pageSize > 1) {
        resolve(
          [pageSize].map((x) => ({
            key: x,
            name: "John Brown",
            age: Math.random(10, 50),
            tags: ["nice", "developer"],
          }))
        );
      } else {
        reject('null')
      }
    }, 1000);
  });
}

export default {
  data() {
    return {
      loadingTable: false,
      tableData: [],
    };
  },
  wtach:{
  },
  mounted() {
  },
  components: {
    HelloWorld,
  },
  created() {
    this.getData();
  },
  methods: {
    //   getData() {
    //   // 假装要使用http_mock发送请求（#手动滑稽#）（mock自动拦截请求并生成数据）
    //   // request
    //   //   .http_mock(
    //   //     "http://route.showapi.com/60-27",
    //   //     "api_id=63114&api_sign=3847b0"
    //   //   )
    //   //   .then((response) => {
    //   //     console.log(response._data);
    //   //   });
    // },
    @loading("loadingTable", (err) => {
      console.log(1,err);
    })
    async getData() {
      console.log(111);
      let tableData = await mockData(1);
      console.log("this.tableData : ", tableData);
    },
  },
};
</script>